package legumes.client.ui.widgets.list.item;

import com.google.gwt.dom.client.Document;
import com.google.gwt.user.client.ui.ComplexPanel;
import com.google.gwt.user.client.ui.Widget;

public class ListItemWidget extends ComplexPanel
{
	public ListItemWidget()
	{
		setElement(Document.get().createLIElement());
//		super((Element) Document.get().createLIElement().cast());
	}

	public ListItemWidget(String s)
	{
		this();
		getElement().setInnerText(s);
	}

	public ListItemWidget(Widget w)
	{
		this();
		this.add(w);
	}
	
	@Override
	public void add(Widget w) {
		// ComplexPanel requires the two-arg add() method
		super.add(w, getElement());
	}

	/**
	 * Return the first added Widget
	 * @return
	 */
	public Widget getWidget() {
		return getWidget(0);
	}

}
